/*
 *  Mutex.h
 *  SoundEngine
 *
 *  Created by Jasony on 09-4-14.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */
#import <pthread.h>

class CMutex {
public:
	CMutex(pthread_mutex_t* pMutex):m_pMutex(pMutex)
	{
		//memset(&m_mutex, 0, sizeof(m_mutex));
		//m_mutex.__sig	= _PTHREAD_MUTEX_SIG_init;
		
		if (m_pMutex)
			pthread_mutex_lock(m_pMutex);
	}
	
	~CMutex()
	{
		if (m_pMutex)
			pthread_mutex_unlock(m_pMutex);
	}
	
private:
	CMutex(const CMutex& other);
	CMutex& operator=(const CMutex& other);
	
	pthread_mutex_t* m_pMutex;
};